<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <!-- 引入样式文件 -->
    <link rel="stylesheet" href="../../common/css/vant-index.css" />
    <link rel="stylesheet" href="../css/monitor.css">

    <!-- 引入 Vue 和 Vant 的 JS 文件 -->
    <script src="../../common/js/vue.min.js"></script>
    <script src="../../common/js/axios.min.js"></script>
	<script src="../../base.js"></script>
    <script src="../../common/js/vue.global.prod.js"></script>
    <!-- 引入 viewer 图片预览样式文件 -->
    <link href="../../common/css/viewer.css" rel="stylesheet" />
    <style>
        .container {
            border: 1px solid #f5f5f5;
            box-shadow: -1px 5px 5px #ececec;
            border-radius: 10px;
            margin: 0.6rem;
            padding: 0.4rem;
        }
		.flex-spb{
			display: flex;
			justify-content: space-between;
			align-items: center;
		}
		.avater img{
			width: 40px;
			height: 40px;
			border-radius: 50%;
			overflow: hidden;
		}
		.pdetail{
			display: flex;
			align-items: center;
		}
		.pdetail img{
			width: 15px;
			height: 15px;
		}
		.van-cell__value{
			color: black;
			font-size: 16px;
		}
		textarea{
			width: 100%;
			border: 1px solid #ebedf0;
			border-radius: 5px;
			margin-top: 10px;
			padding: 5px;
			font-size: 16px !important;
		}
		.van-button--large {
		    width: 80%;
		    margin-left: 10%;
		}
    </style>

</head>

<body>
    <div id="app" v-cloak>
		<div class="container flex-spb">
			<div class="avater">
				<img v-if="!list.patientsImg" src="../img/logo.png" class="visit_img">
				<img v-else :src="list.patientsImg" class="visit_img">
			</div>
			<div class="pdetail">
				<span>{{list.patientsName}}</span>
				<span style="padding: 0 10px;color: #969799;">{{list.age}}岁</span>
				<span><img src="../img/follow/woman.png" class="img_icon" v-if="list.patientsSex==2"></span>
				<span><img src="../img/follow/men.png" class="img_icon" v-if="list.patientsSex==1"></span>
			</div>
		</div>
        
		<div class="container">
			<van-cell>
				<template #title>
					<span class="custom-title"> 复诊项目 </span>
				</template>
				<template #value>
					{{title}}
				</template>
			</van-cell>
			<van-cell>
				<template #title>
					<span class="custom-title"> 执行人 </span>
				</template>
				<template #value>
					{{doctorsName}}
				</template>
			</van-cell>
			<div class="van-cell" style="display: inline-block;">
				<p>备注</p>
				<textarea v-model="remark" cols="3" rows="3" maxlength="50" placeholder="请输入备注，50字以内" placeholder-style='font-size: 16px !important;'></textarea>
			</div>
			
        </div>
		<van-button color="#E22E30" round size="large" @click="setItemStatus" style='margin-top:25px;border-radius: 35px;'>提交</van-button>
    </div>
</body>
<script src="../../common/js/index.umd.js"></script>
<script src="../../common/js/url.min.js"></script>
<script src="../../common/js/vant.min.js"></script>

<script type="module">

    import {
        getAction,
        postAction,
        getUrl,
    } from "../../common/js/api/vue3-axios-utils.js";

    const app = Vue.createApp({

        data() {
            return {
                url: {
                    getfollowList: "/108/01/1080104",
                    setItemStatus:'/flup/patient/item/save',
					getprocess: "/flup/flow",
					getDoctor:'/201/02/2010201'
				},
				list:[],
				patientid:'',
				doctor:[],
				title:'',
				remark:'',
				doctorsName:''
            }
        },
		created() {
			this.itemid = url('?itemid')
			this.id = url('?flupid')
       		this.patientid = url('?patientid')
			this.title = JSON.parse(url('?title'))
       		if(document.referrer.match('/doctor/i')){      //根据上层网址来源判断缓存
				$.ownStore.removeStaffName()
				$.ownStore.removeStaffId()
				console.log('remove',$.ownStore.getStaffId(),$.ownStore.getStaffName())
			}
        		console.log('from',this.from)
            // this.getinfo()
            this.getfollowList()
			this.getprocess()
			this.getDoctor()
		},
        
        methods: {
			setItemStatus() {
				let url = getUrl() + this.url.setItemStatus;
				postAction(url, {
					flupProjectId: this.itemid,
					operator: this.doctorsName,
					doctorId:localStorage.getItem('did'),
					projectName: this.title,
					projectStatus: 1,
					projectSuggest: this.remark,
				}).then((res) => {
				    if (res.data.success) {
				    	console.log('res',res.data.result)
						this.$toast({
							message:'成功'
						})
						self.location=document.referrer
				    }
				})
			},
			getfollowList() {
				let params = {
			        	patientId: this.patientid
			    	};
			    let url = getUrl() + this.url.getfollowList;
			    postAction(url, params).then((res) => {
			        if (res.data.success) {
			            this.list = res.data.result
			        }
			    })
			
			},
			getDoctor() {
				let params = {
				    	doctorId: localStorage.getItem('did')
					};
				let url = getUrl() + this.url.getDoctor;
				postAction(url, params).then((res) => {
				    if (res.data.success) {
				        this.doctorsName = res.data.result.doctorsName
				    }
				})
			},
			getprocess() {
				var itemid = this.itemid,title
			    let params = {
			        flupId: this.id
			    };
			    let url = getUrl() + this.url.getprocess;
			    getAction(url, params).then((res) => {
			        if (res.data.success) {
			            this.list1 = res.data.result.flupFLowItems
						res.data.result.flupFLowItems.forEach(function(v,i,array){
							console.log(v)
							if(v.flupItemId==itemid){
								title = v.projectName
							}
						})
						this.title = title
					}
			    })
			},
			            
        },
    });
    app.use(vant);
    app.use(vant.Lazyload);
    app.use(VueViewer.default);
    app.mount('#app');
</script>

</html>